<?php

class IndexController extends BaseController
{
    public function init()
    {
        parent::init();
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $this->view->title="我要发布";
        // 验证授权信息
        $uid = $this->user_id;
        // 预生成文章
        $article = new \Base\Rest();
        $req = array('uid'=>$uid);
        $rest_res = $article->post('Article',$req,array());
        if ($rest_res->isSuccess() == true) {
            $res = $rest_res->getResponse();
            $this->_redirect('/article/edit?id='.$res->id);
        } else {
            exit('服务器内部错误code[4]');
        }
    }
    public function previewAction()
    {
        
    }



}



